<?php
class CdeModule extends AppModel {

	var $name = 'CdeModule';
	var $validate = array(
		'cde_unit_id' => array('numeric'),
		'title' => array(
			'rule' => 'notempty',
			'message' => 'Module title is required'),
		'description' => array(
			'rule' => 'notempty',
			'message' => 'Module description is required'),
		'introduction' => array(
			'rule' => 'notempty',
			'message' => 'Module introduction is required'),
		'question' => array(
			'rule' => 'notempty',
			'message' => 'Module question is required'),
		'questiontype' => array(
			'rule' => 'notempty',
			'message' => 'Please select the question type'),
		'rightanswerpoint' => array(
			'numeric' => array(
				'rule' => 'numeric',
				'message' => 'Please provide a positive integer value'),
			'positive' => array(
				'rule' => array('comparison', '>', 0),
				'message' => 'Please provide a positive integer value')),
		'wronganswerpoint' => array(
			'numeric' => array(
				'rule' => 'numeric',
				'message' => 'Please provide a non-negative integer value'),
			'non-negative' => array(
				'rule' => array('comparison', '>=', 0),
				'message' => 'Please provide a non-negative integer value')),
		'passpoint' => array(
			'numeric' => array(
				'rule' => 'numeric',
				'message' => 'Please provide a positive integer value'),
			'positive' => array(
				'rule' => array('comparison', '>', 0),
				'message' => 'Please provide a positive integer value')),
		'passmessage' => array(
			'rule' => 'notempty',
			'message' => 'Pass message is required'),
		'failmessage' => array(
			'rule' => 'notempty',
			'message' => 'Fail message is required'),
		'enabled' => array('numeric')
	);

	//The Associations below have been created with all possible keys, those that are not needed can be removed
	var $belongsTo = array(
		'CdeUnit' => array(
			'className' => 'CdeUnit',
			'foreignKey' => 'cde_unit_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);

	var $hasMany = array(
		'CdeAnswer' => array(
			'className' => 'CdeAnswer',
			'foreignKey' => 'cde_module_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		),
		'CdeReferencelink' => array(
			'className' => 'CdeReferencelink',
			'foreignKey' => 'cde_module_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);

}
?>